﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommandLine;
using CommandLine.Text;

namespace IPIdee.MapServices.Client.CmdUtil
{
    class Options
    {
        #region Standard Option Attribute

        [Option(null, "action", Required = true, HelpText = "The action to perform (p.e. 'resolve')")]
        public string Action = String.Empty;

        [Option(null, "locationname", Required = false, HelpText = "The name of the location to resolve (this is the full name, for example foobar^example.com)")]
        public string LocationName = String.Empty;

        [Option(null, "privatekey", Required = false, HelpText = "The private key to be used for the action")]
        public string PrivateKey = String.Empty;

        [Option(null, "output", Required = false, HelpText = "The output (p.e. 'json' or 'txt')")]
        public string Output = "json";      // default

        [Option(null, "latitude", Required = false, HelpText = "The latitude (p.e. 52.362942)")]
        public double Latitude = 52.362942; // default

        [Option(null, "longitude", Required = false, HelpText = "The longitude (p.e. 4.923983)")]
        public double Longitude = 4.923983; // default

        [Option(null, "zoomlevel", Required = false, HelpText = "The zoomlevel (p.e. 17)")]
        public int ZoomLevel = 17;          // default

        [Option(null, "override", Required = false, HelpText = "Indication whether item(s) should be overriden (p.e. true)")]
        public bool Override = false;       // default

        #endregion

        #region Specialized Option Attribute

        [HelpOption(HelpText = "Display this help screen.")]
        public string GetUsage()
        {
            var help = new HelpText(Program._headingInfo);
            help.AdditionalNewLineAfterOption = true;
            help.Copyright = new CopyrightInfo("IPIdee (Constantum/Reiz IT Solutions/Xirmo)", 2010, 2010);
            help.AddPreOptionsLine("Usage: CmdUtil --action=resolve --locationname=foobar^example.com");
            help.AddPreOptionsLine("Usage: CmdUtil --action=register --locationname=foobar^example.com --lat=52.362942 --lng=4.923983 --zoom=17");
            help.AddOptions(this);

            return help;
        }
        #endregion
    }
}
